<template>
  <Lauoyt >
  <router-view v-slot="{ Component, route }">
    <transition :name="route.meta.transition || 'fade'" mode="out-in">
      <keep-alive :include="['Home']">
        <component :is="Component" :key="route.meta.usePathKey ? route.path : undefined" ref="pageComponent"/>
      </keep-alive>
    </transition>
  </router-view>
  </Lauoyt>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import Lauoyt from '@/components/layout/Layout.vue'

export default defineComponent({
  components: {
    Lauoyt
  },
  mounted () {
    window.addEventListener('message', e => {
      // receive 接收
      if (e.data && e.data.type && e.data.type === 'receive') {
        console.log('receive 接收addEventListener', e.data.data)
      }
    }, false)
  }
})
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

</style>
